<template>
  <div class="page-emr-content">
    <chief-complaint></chief-complaint>
    <present-illness-history></present-illness-history>
    <past-history></past-history>
    <personal-history></personal-history>
    <family-history></family-history>
  </div>
</template>
<script>
  import {
    chiefComplaint,
    presentIllnessHistory,
    pastHistory,
    personalHistory,
    familyHistory,
  } from './components'
  import { YEARS, MONTHS, DAYS, FULLYEARS } from '@/utils/config'
  import { provide } from 'vue'
  export default {
    components: {
      chiefComplaint,
      presentIllnessHistory,
      pastHistory,
      personalHistory,
      familyHistory,
    },
    setup() {
      provide('YEARS', YEARS)
      provide('MONTHS', MONTHS)
      provide('DAYS', DAYS)
      provide('FULLYEARS', FULLYEARS)

      provide('clearValue', function (model, val) {
        const tmp = Array.isArray(val) ? val : [val]
        tmp.forEach((item) => {
          if (model[item]) {
            Array.isArray(model[item])
              ? (model[item] = [])
              : (model[item] = null)
          }
        })
      })
    },
  }
</script>
<style lang="scss" scoped>
  @import '@/styles/emr.scss';
  .footer {
    margin-left: 5px;
    display: flex;
    justify-content: flex-end;
  }
</style>
